// 测试
import { ajaxService } from '@/utils/request';

const baseURL = 'http://127.0.0.1:3111';

// 获取
export function getUser(params: any) {
  return ajaxService({
    url: '/demo',
    method: 'get',
    params,
    baseURL
  });
}

// 新增
export function PostUser(data: any) {
  return ajaxService({
    url: '/demo',
    method: 'post',
    baseURL,
    data
  });
}

// 删除
export function DelUser(id: any) {
  return ajaxService({
    url: `/demo/${id}`,
    method: 'delete',
    baseURL
  });
}

// 编辑
export function PutUser(data: any) {
  return ajaxService({
    url: '/demo',
    method: 'put',
    baseURL,
    data
  });
}

// 获取
export function getDimission() {
  return ajaxService({
    url: '/dimission',
    baseURL
  });
}

// 获取
export function getCause(id: number) {
  return ajaxService({
    url: '/dimission/getCause/' + id,
    baseURL
  });
}

// 新增
export function PostDimissions(data: any) {
  return ajaxService({
    url: '/dimission',
    method: 'post',
    baseURL,
    data
  });
}

// 新增
export function PostCause(data: any) {
  return ajaxService({
    url: '/dimission/addCause',
    method: 'post',
    baseURL,
    data
  });
}

// 编辑
export function PutDimissions(id: number, data: any) {
  return ajaxService({
    url: '/dimission/' + id,
    method: 'put',
    baseURL,
    data
  });
}

// 编辑
export function PutCause(id: number, data: any) {
  return ajaxService({
    url: '/dimission/setCause' + id,
    method: 'put',
    baseURL,
    data
  });
}

// 删除
export function DelCause(id: any) {
  return ajaxService({
    url: `/dimission/${id}`,
    method: 'delete',
    baseURL
  });
}
// 获取数据来源内容数据
export function getDataResourcesValue(data: {
  url: string;
  method: 'post' | 'get';
  params?: any;
}) {
  return ajaxService<any>({
    url: data.url,
    method: data.method,
    params: data.params,
    // data:data.params,
    baseURL: 'http://192.168.31.129:39001'
  });
}
/**
 * 数据来源详情
 * @param id
 * @returns
 */
export async function getDataResourcesById(id: number) {
  return ajaxService<any>({
    url: `/platform_management/platform_ccc/dr/data/resources/${id}`,
    method: 'get',
    baseURL: 'http://192.168.31.113:9081'
  });
}
